package org.example.gateway.common;

import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;

/**
 * Description: BackHttpStatus
 * Author: e
 * CreateDate: 2021-05-31
 */
public class BackHttpStatus {

    public static DataBuffer wrap(ServerHttpResponse response,HttpStatus httpStatus){
        //状态码
        response.setStatusCode(httpStatus);
        String data = "<h1>"+ httpStatus + "</h1> ";
        return response.bufferFactory().wrap(data.getBytes());
    }

}
